package com.ThreadImp;

//实现 Runnable接口  对比继承Thread类
public class RunnableThread implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            System.out.println("runnable接口的调用实现线程"+i+Thread.currentThread().getName());
        }
    }

    public static void main(String[] args) {
        //创建Runnable接口实例对象
        RunnableThread runnableThread = new RunnableThread();
        //创建线程对象 ，线程对象开启代理线程
        new Thread(runnableThread,"ad").start();

        for (int i = 0; i < 200; i++) {
            System.out.println("main"+i+Thread.currentThread().getName());
        }

    }

}
